#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H

#include <QWidget>
#include "videoplayer.h"

class VideoWidget : public QWidget
{
    Q_OBJECT
public:
    explicit VideoWidget(QWidget *parent = nullptr);
    ~VideoWidget();
public slots:
    void onPlayerFrameDecoded(VideoPlayer *player, uint8_t *data, VideoPlayer::VideoSwsSpec &spec);
    void onPlayerStateChanged(VideoPlayer* player);
private:
    QImage* m_image = nullptr;
    QRect   m_rect;
    void paintEvent(QPaintEvent* ev) override;
    void freeImage();
};

#endif // VIDEOWIDGET_H
